'use strict';
module.exports = function (sequelize, DataTypes) {

// 客服
  let CustomerService = sequelize.define('CustomerService', {
    id: {
      type: DataTypes.INTEGER.UNSIGNED,
      primaryKey: true,
      autoIncrement: true
    },
    userId: {
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false
    },
    storeName: {
      type: DataTypes.STRING(56),
      allowNull: false
    },
    storeId: {
      type: DataTypes.STRING(20),
      allowNull: false
    },
    serviceType: {
      type: DataTypes.INTEGER.UNSIGNED,
      allowNull: false
    }
  }, {
    classMethods: {
      associate: function (models) {
        CustomerService.belongsTo(models.User, {
          foreignKey: 'userId',
          constraints: false
        });
      }
    },
    tableName: 'customer_services'
  });

  return CustomerService;
};
